package com.xz.realdemo.factory;

import com.xz.realdemo.domain.HistogramChart;
import com.xz.realdemo.domain.LineChart;
import com.xz.realdemo.domain.PieChart;
import com.xz.realdemo.factoryinterface.Chart;

import javax.swing.text.ElementIterator;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     ChartFactory   
 * @package    com.xz.realdemo.factory  
 * @date   2019/11/24 17:41  
 * @explain 图表工厂类
 */
public class ChartFactory {

    public static Chart getChart(String type) {
        Chart chart = null;
        if ("histogram".equalsIgnoreCase(type))
            chart = new HistogramChart();
        else if ("line".equalsIgnoreCase(type))
            chart = new LineChart();
        else if ("pie".equalsIgnoreCase(type))
            chart = new PieChart();

        return chart;
    }

}
